The present invention relates to a method for automatic regulation of the characteristics of an optical code reading system.
The term xe2x80x9coptical codexe2x80x9d is used below to denote any graphic representation that has the function of storing coded data. A particular example of an optical code comprises linear or two-dimensional codes, wherein the data is coded by suitable combinations of elements with a predetermined shape, for example squares, rectangles or hexagons, of dark colour (usually black) separated by light elements (spaces, usually white), such as bar codes, stacked codes (including PDF417), Maxicode, Datamatrix, QR-Code, colour codes etc. The term xe2x80x9coptical codexe2x80x9d further comprises, more generally, other graphical forms with the aim of coding information, including uncoded characters (letters, numbers, etc.) and specific patterns (such as stamps, logos, signatures etc). The information may also be coded by more than two colours, in grey tones for example.
The optical codes can be read by acquiring two-dimensional images in the area where a code is expected to be and localizing the code inside the image. In general, code localization involves a series of steps for initially distinguishing, within the previously stored image, the region or regions where at least one code is present; then localizing specific recognition patterns typical for each code; acquiring data concerning actual code type; and finally accurately delimiting the code. Subsequently, the delimited image of the code is processed to extract the features necessary for decoding and finally, the code is decoded to extract the data required. In particular, decoding can be completed successfully, when data are extracted and recognised as correct, or it can be completed negatively, when the processing system does not succeed in extracting any data, or when the probability of the data extracted being correct is insufficient, or when the data extracted does not correspond to the data required.
The reading success probability depends on a plurality of factors, some of which are external to the reading system (such as quality of the optical code to be read), and others are due to the opto-electrical/mechanical parameters of the reading system. In fact, every reading system, like any other physical system, has variable characteristics, depending on the individual product, on the type of installation and on time. In particular, the characteristics of the reading system depend on the individual components having characteristics varying within a specific tolerance (spread). In addition, the characteristics of many components vary as their external conditions vary (e.g. the temperature) and are subjected to ageing.
To eliminate these problems, methods for calibration are known, used both during production and installation; in addition, methods for regulation are known which are controlled automatically or by an operator and act during working of the system concerned.
In an optical code reading system for objects in uninterrupted movement, it is particularly difficult to regulate the characteristics, since it is not possible to concentrate on a reference image and the characteristics of the images to be acquired vary very quickly.
For a better understanding of the existing problem, reference is made to FIG. 1, which shows a typical optical code reading system, generally indicated at 1, comprising a conveyor belt 2, supporting an object 3 carrying an optical code 4, in this case a bar code. The conveyor belt 2 is associated to an optical encoder 5 for measuring the speed of the object 3; in addition, at one side of the conveyor belt 2, a presence sensor 6 and a height sensor 7 are present. Above the conveyor belt 2, an image acquisition device 10 is arranged, having a sensitive area 11 and supporting a lighting element 12; the image acquisition device 10 is also connected to a processing unit 13, here represented by a personal computer, which can optionally also be integrated in the image acquisition device 10.
For correct working of a system of the type shown in FIG. 1, it is essential to have correct setting of many parameters of the image acquisition device 10, of the lighting element 12 and of the processing unit 13. In particular, in an optical code reading system, essential characteristics comprise image focussing and brightness; other important characteristics are for example apparent dimensions of the object to be read and fixed deformations of the optical code, caused by printing and/or perspective phenomena. These characteristics can be detected directly or by measuring some physical quantities. For example, image focussing can be detected by measuring the energy of an analogue or digital signal supplied by the image acquisition device 10, since, as known, blurred images have low brightness gradients and therefore low energy.
The characteristics of the reading system, and thus the corresponding measuring quantities, depend on the value of a plurality of parameters of the reading system; for example, among the parameters that may be regulated, the following are important: position of the automatic focussing device; sensitivity of the image acquisition device 10 (i.e. gain of the circuits inside the device 10 that acquire and carry out initial processing of the electrical signals generated in the sensitive area 11); power irradiated by the lighting device 11 (i.e. the supply voltage provided to the lighting element 12); speed of scanning of the object to be examined (set externally, but dependant on the movement speed of the conveyor belt 2); and threshold values necessary in the decoding process, to decide, for example, whether a specific voltage level corresponds to a xe2x80x9cwhitexe2x80x9d or to a xe2x80x9cblackxe2x80x9d. In addition, the optimum value of some of these parameters (for example the position of the automatic focussing device, the irradiated power and the sensitivity of the telecamera), depend on the height of the object with respect to the image acquisition device 10.
In a reading system where the images acquired in sequence differ little from one another (for example in television shots), the problem of optimising these parameters has already been solved in various ways. For example, all commercial television telecameras have an automatic gain control, allowing them to adapt to the various lighting conditions: analysis of the latest acquired image allows the telecamera to adapt its sensitivity for acquiring the successive images, which, it is assumed, do not differ significantly from the present image. Similarly, all modern commercial telecameras have an automatic focussing device analyzing the latest acquired images (for example based on color convergence).
In practice, feedback mechanisms are used for quickly obtaining the best possible quality of the image.
However, the aforementioned feedback mechanism no longer functions when the image characteristic variation speed becomes so fast to be comparable to the acquisition speed, i.e. when the images acquired in sequence can be completely different from one another. In these cases it is necessary to predict the characteristics of the next image to appear to the telecamera and to optimise a priori all the acquisition parameters.
The use of additional sensors, for example supplying in advance the data concerning the distance between the object and the telecamera or its average brightness value, can improve the prediction capacities, but often this is not sufficient.
For example, the lighting variations caused by the lamp ageing cannot be measured (and therefore compensated for), simply by evaluating the average brightness value measured on the objects to be acquired: an excessively long sequence of dark objects could cause to believe that the lighting unit has suddenly aged.
Similarly, the optimum focussing position could vary over time, owing to fluctuations of the electro-mechanical characteristics of the automatic focussing positioning device or of the distance sensors.
The object of the invention is thus to provide a method for automatic regulation eliminating the disadvantages of the known solutions and applicable in particular in case of high variation speed of the characteristics of successive images.
According to the present invention, a method is provided for automatic regulation of at least one characteristic variable of an optical code reading system, characterised by the steps of:
a) acquiring an image;
b) attempting a reading of at least one optical code in said image;
c) verifying whether said reading has been completed successfully;
d) if so, detecting said characteristic variable for said image; and
e) modifying at least one controlled parameter acting on the variation of said measured characteristic variable.
The characteristic variable (or quantity) is advantageously acquired several times, to obtain an average statistical datum for a large number of readings and to measure any substantial differences between successive images; in addition, the regulation is carried out continually, to monitor the reading system characteristics variations due to environmental causes or to modifications of the internal components.
The regulated characteristic quantities comprise image brightness and the focussing quality and the controlled parameters are selected from focussing position, image acquisition sensitivity, lighting power, decision threshold values used in reading and image scanning speed.
If the relationship between each controlled parameter and the respective characteristic quantities is not known, the present method modifies the value of the present parameter by at least one small positive displacement and one small negative displacement with respect to the present value and acquires the value of the respective characteristic variable in both cases, to evaluate which of the two displacements provides better image quality. The new value of the controlled parameter becomes the central value for the successive readings. By repeating this process, the central value of the controlled parameter tends quickly towards the optimum position and any variations of this position over time are monitored.